package com.nkzy.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private int code;
    private String msg;
    private Object data;
    //类中static表示静态方法，不需要创建对象，直接调用即可,类名+点
    //成功，有数据
    public static Result ok(Object data) {
        return new Result(1, "success", data);
    }
    //失败
    public static Result fail(String msg) {
        return new Result(0, msg, null);
    }
    //成功没有数据
    public static Result ok() {
        return new Result(1, "success", null);
    }
}
